<?php
class Application_Model_Filter_AutotaskSearch {
    /**
     * 快速搜索
     */
    public $quick;
    /**
     * 时间格式
     */
    public $timescope;
    /**
     * 开始时间
     */
    public $startTime;
    /**
     * 结束时间
     */
    public $endTime;
    /**
     * 任务类型
     */
    public $jobType;
    /**
     * 执行类型
     */
    public $jobExecute;
    /**
     * 任务状态
     */
    public $jobDisable;
    /**
     * 执行状态  
     */
    public $lastStatus;
    
    
    function getSearchFileds()
    {
        $where = array();
        $and = "";
        if($this->quick != ""){
            $where[$and." ( name like "] = "%".$this->quick."%";
            $where[" or description like "] = "%".$this->quick."%";
            $where[" ) and 1 = "] =1;
            $and = " and ";
        }
        if($this->startTime != ""){
            $where[$and . " dateCreated >= "] = $this->startTime;
            $and = " and ";
        }
        if($this->endTime != ""){
            $where[$and . " dateCreated <= "] = $this->endTime." 23:59:59";
            $and = " and ";
        }
        
        if($this->jobType != ""){
            $where[$and." type = "] = $this->jobType;
            $and = " and ";
        }
        if($this->jobExecute != ""){
            $where[$and." dateType = "] = $this->jobExecute;
            $and = " and ";
        }
        if($this->jobDisable != ""){
            $where[$and." isDisable = "] = $this->jobDisable;
            $and = " and ";
        }
        if($this->lastStatus != ""){
            $where[$and." lastStatus = "] = $this->lastStatus;
            $and = " and ";
        }
        return $where;
    }
}
